.InsightCard {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    min-width: 0;
    max-width: 100%;
    height: 30rem;
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border 200ms ease;

    &--highlighted {
        border-color: var(--primary-3000);
        outline: 1px solid var(--primary-3000);
    }

    &.react-draggable::after {
        // During dashboard layout editing, we need an overlay to prevent accidental interaction with card content
        position: absolute;
        inset: 0;
        z-index: var(--z-content-overlay);
        content: '';
    }

    .ErrorBoundary {
        width: 100%;
        height: 100%;
        margin: auto;
    }
}

.InsightCard__viz {
    position: relative;
    display: flex;
    flex: 1;
    flex-direction: column;
    width: 100%;
    overflow: auto;
    border-radius: 0 0 var(--radius) var(--radius);

    .LineGraph,
    .AnnotationsOverlay {
        padding: 0.5rem;
    }

    .insight-empty-state {
        height: 100%; // Fix wonkiness when SpinnerOverlay is shown
        padding-top: 0;
        padding-bottom: 0;
        font-size: 0.875rem; // Reduce font size
    }

    .LemonTable {
        background: none;
        border: none;
        border-radius: 0;
    }

    .WebAnalyticsDashboard .InsightVizDisplay & {
        min-height: var(--insight-viz-min-height);
    }
}

.InsightDetails,
.CardMeta .InsightDetails {
    // Including .CardMeta to increase specificity there, specifically for h5
    font-size: 0.8125rem;
    line-height: 1.5rem;

    h5 {
        margin-bottom: 0.125rem;
        line-height: 1.5rem;
    }

    section:not(:last-child) {
        margin-bottom: 0.5rem;
    }

    .LemonRow {
        min-height: 2rem;
        font-size: inherit;
    }
}

.InsightDetails__query {
    padding: 0.375rem 0.5rem;
    margin-top: 0.25rem;
    border-width: 1px;
    border-radius: var(--radius);

    .LemonRow {
        padding-right: 0;
        padding-left: 0;
    }
}

.InsightDetails__formula {
    code {
        margin-left: 0.375rem;
        font-weight: 600;
    }
}

.InsightDetails__series {
    margin: -0.125rem 0;

    &:not(:first-child) {
        margin-top: 0.5rem;
    }

    .LemonDivider {
        width: calc(100% - 1.5rem);
        margin-left: 1.5rem;
    }
}

.InsightDetails__breakdown {
    margin-bottom: 0.5rem;
}

.InsightDetails__footer {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 2rem;

    .profile-package {
        vertical-align: middle;
    }

    .taxonomic-breakdown-filter.tag-pill {
        padding: 0;
        font-size: 0.8125rem;
        vertical-align: unset;
        background: none;
        border: none;
        border-radius: 0;
    }
}

.SeriesDisplay {
    line-height: 1.5rem;
}

.SeriesDisplay__raw-name {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.25rem;
    margin: 0 0.25rem;
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1rem;
    color: var(--text-3000);
    background: var(--primary-highlight);
    border-radius: var(--radius);

    &.SeriesDisplay__raw-name--action,
    &.SeriesDisplay__raw-name--event {
        padding: 0.25rem;

        &::before {
            display: inline-block;
            flex-shrink: 0;
            width: 1rem;
            margin-right: 0.25rem;
            font-size: 0.625rem;
            font-weight: 700;
            line-height: 1rem;
            color: var(--bg-light);
            text-align: center;
            background: var(--primary-3000);
            border-radius: var(--radius);
        }
    }

    &.SeriesDisplay__raw-name--action::before {
        content: 'A';
    }

    &.SeriesDisplay__raw-name--event::before {
        content: 'E';
    }
}

.SeriesDisplay__condition {
    display: flex;

    .SeriesDisplay__raw-name {
        vertical-align: middle;
    }
}

.SeriesDisplay__arrow {
    flex-shrink: 0;
    margin-right: 0.25rem;
    font-size: 1.25rem;
    color: var(--border-bold);
}
